<%-- 
    Document   : editarPaciente
    Created on : 24/11/2013, 14:18:51
    Author     : rosana
--%>

<%@page import="model.Convenio"%>
<%@page import="model.Paciente"%>
<%@page import="java.util.Iterator"%>
<%@page import="java.util.ArrayList"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>        
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <link href="css/bootstrap.min.css" rel="stylesheet" media="screen">
        <link href="css/style.css" rel="stylesheet" type="text/css" />
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
        <script type="text/javascript" src="js/bootstrap.min.js"></script>
        <title>Clínica Médica - Sua saúde em primeiro lugar</title>        
    </head>
    <body>        
        <div class="container">
            <jsp:include page="cabecalho.jsp" flush="true" />       
            <div class="content">
                <div class="panel panel-default espaco-form">                                         
                    <div class="row">
                        <div class="col-md-10">
                            <h3>Editar Paciente</h3>
                        </div>
                        <div class="col-md-2">
                            <a class="btn btn-success pull-right espaco-botao" href="javascript:history.back(1)" title="Voltar">Voltar</a>                    
                        </div>                        
                    </div>  
                    <br>
                    <form method="POST" class="cadastros" action="FrontController">
                        <% Paciente pec = (Paciente) session.getAttribute("paciente");%>
                        <div class="row">
                           <div class="col-md-1">
                               <label for="informa-nome">Nome:</label>        
                           </div>
                           <div class="col-md-4">                           
                               <input class="input-text" id="informa-nome" type="text" name="nome" value="<%=pec.getPessoa().getNome()%>" required>                              
                           </div>
                        </div>
                        <div class="row">
                           <div class="col-md-1">
                               <label for="informa-cpf">CPF:</label>
                           </div>
                           <div class="col-md-4">                           
                               <input class="input-text" id="informa-cpf" type="text" name="cpf" value="<%=pec.getPessoa().getCpf()%>" required>                               
                           </div>
                        </div>
                        <div class="row">
                           <div class="col-md-1">
                               <label for="informa-rg">RG:</label>        
                           </div>
                           <div class="col-md-4">
                               <input class="input-text" id="informa-rg" type="text" name="rg" value="<%=pec.getPessoa().getRg()%>" required>                               
                           </div>
                        </div>                    
                        <div class="row">
                           <div class="col-md-1">
                               <label class="label-grande" for="informa-nasc">Data de Nascimento:</label>        
                           </div>
                           <div class="col-md-4">
                               <input class="input-text" id="informa-nasc" type="text" name="dataNasc" value="<%=pec.getPessoa().getDataNasc()%>" required>                               
                           </div>
                        </div> 
                        <div class="row">
                           <div class="col-md-1">
                               <label for="informa-end">Endereço:</label>        
                           </div>
                           <div class="col-md-4">
                               <input class="input-text" id="informa-end" type="text" name="endereco" value="<%=pec.getPessoa().getEndereco()%>" required>                               
                           </div>
                        </div>
                        <div class="row">
                           <div class="col-md-1">
                               <label for="informa-tel">Telefone:</label>        
                           </div>
                           <div class="col-md-4">
                               <input class="input-text" id="informa-tel" type="tel" name="telefone" value="<%=pec.getPessoa().getTelefone()%>" required>
                           </div>
                        </div>
                        <div class="row">
                           <div class="col-md-1">
                               <label for="informa-cel">Celular:</label>        
                           </div>
                           <div class="col-md-4">
                               <input class="input-text" id="informa-cel" type="tel" name="celular" value="<%=pec.getPessoa().getCelular()%>" required>
                           </div>
                        </div>                        
                        <div class="row">
                           <div class="col-md-1">
                               <label for="informa-email">E-mail:</label>        
                           </div>
                           <div class="col-md-4">
                               <input class="input-text" id="informa-email" type="email" name="email"value="<%=pec.getPessoa().getEmail()%>">
                           </div>
                        </div>
                        <div class="row">
                           <div class="col-md-1">
                               <label for="informa-pasta">Nº Pasta:</label>        
                           </div>
                           <div class="col-md-4">
                               <input class="input-text" id="informa-pasta" type="text" name="numPasta" value="<%=pec.getNumPasta()%>" required>                               
                           </div>
                        </div>
                        <div class="row">
                           <div class="col-md-1">
                               <label class="label-grande" for="informa-respons">Nome Responsável:</label>        
                           </div>
                           <div class="col-md-4">
                               <input class="input-text" id="informa-respons" type="text" name="nomeResp" value="<%=pec.getNomeResp()%>">                                      
                           </div>
                        </div>
                        <div class="row">
                           <div class="col-md-1">
                               <label for="informa-dignostico">Diagnóstico:</label>        
                           </div>
                           <div class="col-md-4">
                               <textarea class="text-area" id="informa-dignostico" name="diagnostico" value=""><%=pec.getDiagnostico()%></textarea>                               
                           </div>
                        </div>        
                        <div class="row">
                           <div class="col-md-1">
                               <label for="informa-convenio">Convênio:</label>        
                           </div>
                           <div class="col-md-4">
                               <select class="input-text" id="informa-convenio" name="convenio" required>                               
                               <% 
                                ArrayList listaConvenio= (ArrayList) session.getAttribute("listaConvenios");                            
                                Iterator it3 = listaConvenio.iterator();                            
                                while (it3.hasNext()) {
                                    Convenio con = (Convenio) it3.next();
                                    int id= con.getIdConvenio();
                                    String nome = con.getNome();

                                    System.out.println("Convenio: " + con.getIdConvenio()+ " - " + con.getNome());
                                %>                            
                                <option value="<%=id%>"><%=nome%></option>                            
                                <% } // Fecha o while%>       
                            </select> 
                           </div>
                        </div>                      
                            <input type="hidden" name="idPaciente" value="<%=pec.getPessoa().getIdPessoa()%>"> 
                        <input type="hidden" name="servlet" value="UpdatePaciente">
                        <div class="row">
                           <div class="col-md-4">                                                           
                               <input class="input-submit pull-right button-ok" type="submit" value="Salvar"> 
                               <input class="input-limpar pull-right button-ok" type="button" value="Cancelar" onClick="history.back()">                                                                                 
                           </div>
                        </div>                        
                    </form>                      
                </div>
            </div>  
            <jsp:include page="rodape.jsp" flush="true" />
        </div>        
    </body>
</html>